/**
 * Created by yk on 2017/9/28.
 */
console.log(document.documentElement.clientWidth);
//设置rem字体尺寸100
document.documentElement.style.fontSize = document.documentElement.clientWidth / 640 * 100 + "px";
if(document.documentElement.clientWidth>640){
    document.documentElement.style.fontSize=100+"px";
}
	// 重写系统alert去掉url
	window.alert = function(name) {
		var iframe = document.createElement("IFRAME");
		iframe.style.display = "none";
		iframe.setAttribute("src", 'data:text/plain,');
		document.documentElement.appendChild(iframe);
		window.frames[0].window.alert(name);
		iframe.parentNode.removeChild(iframe);
	};
//横屏无效
window.addEventListener("orientationchange", function() {
    // Announce the new orientation number
    if(0!==window.orientation){
        alert('请竖屏浏览')
    }
}, false);

//
//document.documentElement.style.height = window.innerHeight + 'px';


//表单序列化
function arry2json(arry){
    if(!arry.length){
        console.log('bad form');
        return;
    }
    var newArry={};
    for(var i=0;i<arry.length;i++){
        newArry[arry[i]['name']]=arry[i]['value'];
    }
    return newArry;
}

function getServerHost() {

    var host1 = "..";
    // var host2 = "http://chyin.site:8092";
     var host2 = "http://wx7.unisk.cn/wsg-wechat";
    return host2;
    // return host2;
}

//截取url键值对
function GetRequest() {
    var url = location.search; //获取url中"?"符后的字串
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for(var i = 0; i < strs.length; i ++) {
            theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}
//禁止滑动
    function preventMove(){
        document.addEventListener('touchmove', function(e) {
            e.preventDefault();
        }, false);
    }
